/*
 * AbstractStrategy.cpp
 *
 *  Created on: 2010-01-13
 *      Author: adas
 */

#include "AbstractStrategy.h"
#include "utils.h"

void AbstractStrategy::calculatePoint(Element & el_, int populationCount_, double weightFactor_, const std::vector<Element *> &population_)
{
	int x1, x2, x3;

	x1 = (int)randomUniform(0.0, (double)populationCount_);
	x2 = (int)randomUniform(0.0, (double)populationCount_);
	x3 = (int)randomUniform(0.0, (double)populationCount_);

	//std::cout << "x1: " << x1 << ", x2: " << x2 << ", x3: " << x3 << std::endl;

	el_ = *population_[x3];
	el_ -= *population_[x2];
	el_ *= weightFactor_;
	el_ += *population_[x1];
}
